#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Purpose: Test units module
# Created: 02/16/2009
# $Id $
# Copyright (c) 2008,2009 by University College London
# Authors:
# Didrik Pinte --<dpinte@dipole-consulting.com>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with HydroPlatform for details.

import datetime
import unittest

import support
support.init_hydroplatform()

from hydroplatform.model import units

class TestUnit(unittest.TestCase):
    
    def test_dateserie(self):
        
        d1 = datetime.date(2000,10,1)
        d2 = datetime.date(2002,9,1)
        dserie = units.getDateSerie(d1, d2, units.MONTHLY)
        self.assertEqual(len(dserie), 24)
        dserie = units.getDateSerie(d1, d2, units.YEARLY)
        self.assertEqual(len(dserie), 2)
        dserie = units.getDateSerie(d1, d2, units.DAILY)
        self.assertEqual(len(dserie), 701)
        dserie = units.getDateSerie(d1, d2, 0, 'days', 1)
        self.assertEqual(len(dserie), 701)


if __name__=='__main__':
    unittest.main()